package ManHinhChinh;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import ManHinhChinh.ConnectSQL;
public class NhaCungCap {

	protected Shell shlNhCungCp;
	private Text txtMaNCC;
	private Text txtTenNCC;
	private Text txtDiaChiNCC;
	private Text txtSDTNCC;
	private Text txtEmail;


	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shlNhCungCp.open();
		shlNhCungCp.layout();
		while (!shlNhCungCp.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 * @wbp.parser.entryPoint
	 */
	protected void createContents() {
		shlNhCungCp = new Shell();
		shlNhCungCp.setSize(375, 335);
		shlNhCungCp.setText("Th\u00EAm Nh\u00E0 Cung C\u1EA5p");
		
		Label lblNewLabel = new Label(shlNhCungCp, SWT.NONE);
		lblNewLabel.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblNewLabel.setBounds(23, 29, 129, 19);
		lblNewLabel.setText("M\u00E3 Nh\u00E0 Cung C\u1EA5p");
		
		Label lblNewLabel_1 = new Label(shlNhCungCp, SWT.NONE);
		lblNewLabel_1.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblNewLabel_1.setBounds(23, 68, 119, 19);
		lblNewLabel_1.setText("T\u00EAn Nh\u00E0 Cung C\u1EA5p");
		
		Label lblNewLabel_2 = new Label(shlNhCungCp, SWT.NONE);
		lblNewLabel_2.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblNewLabel_2.setBounds(23, 109, 151, 19);
		lblNewLabel_2.setText("\u0110\u1ECBa Ch\u1EC9 Nh\u00E0 Cung C\u1EA5p");
		
		Label lblNewLabel_3 = new Label(shlNhCungCp, SWT.NONE);
		lblNewLabel_3.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblNewLabel_3.setBounds(23, 150, 129, 19);
		lblNewLabel_3.setText("S\u1ED1 \u0110i\u1EC7n Tho\u1EA1i NCC");
		
		Label lblNewLabel_4 = new Label(shlNhCungCp, SWT.NONE);
		lblNewLabel_4.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
		lblNewLabel_4.setBounds(23, 191, 55, 19);
		lblNewLabel_4.setText("Email");
		
		Button btnNewButton = new Button(shlNhCungCp, SWT.NONE);
		btnNewButton.setImage(SWTResourceManager.getImage("D:\\Java_WorkSpace\\_QuanLyBanHang\\image\\ADD.ICO"));
		btnNewButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				String a = txtMaNCC.getText().trim();
				String b = txtTenNCC.getText().trim();
				String c = txtDiaChiNCC.getText().trim();
				String d = txtSDTNCC.getText().trim();
				String f = txtEmail.getText().trim();
				ConnectSQL cn= new ConnectSQL();
				cn.GhiNhaCC(a, b, c, d, f);
				MessageBox mss = new MessageBox(shlNhCungCp,SWT.ICON_WORKING | SWT.OK);
				mss.setText("Đã Thêm Thành Công Nhà Cung Cấp");
				mss.setMessage("Thành Công");
				mss.open();
			}
		});
		btnNewButton.setBounds(130, 242, 92, 32);
		btnNewButton.setText("Th\u00EAm");
		
		txtMaNCC = new Text(shlNhCungCp, SWT.BORDER);
		txtMaNCC.setBounds(178, 27, 171, 21);
		
		txtTenNCC = new Text(shlNhCungCp, SWT.BORDER);
		txtTenNCC.setBounds(178, 68, 171, 21);
		
		txtDiaChiNCC = new Text(shlNhCungCp, SWT.BORDER);
		txtDiaChiNCC.setBounds(178, 109, 171, 21);
		
		txtSDTNCC = new Text(shlNhCungCp, SWT.BORDER);
		txtSDTNCC.setBounds(178, 148, 171, 21);
		
		txtEmail = new Text(shlNhCungCp, SWT.BORDER);
		txtEmail.setBounds(178, 191, 171, 21);

	}
}
